<template>
  <el-table
    border
    :data="filteredData ? filteredData : data"
    style="width: 100%"
    :height="height"
  >
    <el-table-column prop="itemName" label="项目" />
    <el-table-column prop="sgCount" label="事故起数" />
    <el-table-column prop="sgCountRatio" label="占总数" />
    <el-table-column prop="swrsCount" label="死亡人数" />
    <el-table-column prop="swrsCountRatio" label="占总数" />
    <el-table-column prop="ssrsCount" label="受伤人数" />
    <el-table-column prop="ssrsCountRatio" label="占总数" />
  </el-table>
</template>

<script setup>
const props = defineProps({
  data: {
    type: Array,
  },
  height: {
    type: Number,
  },
  type: {
    type: String,
  },
  name: {
    type: String,
  },
});
const filteredData = computed(() => {
  if (props.type === "Weather") {
    return props.data.filter((item) => item.itemName === props.name);
  }
});
</script>

<style lang="less" scoped></style>
